package ui;
import java.awt.Dimension;
//import javax.swing.JButton;
//import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
//import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
//import javax.swing.JTextField;

public class home extends JFrame {
	
	private JPanel home;//主面板
	private JPanel send;//发送
	private JPanel receive;//接收
	private JTabbedPane tbPane;//tab面板
	//private JLabel Baud1;//串口波特率
	//private JLabel Baud2;//CAN波特率
	private JLabel id;//序号
	private JLabel trans;//传输方向
	private JLabel time;//时间标识
	private JLabel fid;//帧ID
	private JLabel fformat;//帧格式
	private JLabel type;//帧类型
	private JLabel length;//数据长度
	private JLabel hex;//数据
	private JLabel id1;//序号
	private JLabel trans1;//传输方向
	private JLabel time1;//时间标识
	private JLabel fid1;//帧ID
	private JLabel fformat1;//帧格式
	private JLabel type1;//帧类型
	private JLabel length1;//数据长度
	private JLabel hex1;//数据
	private JMenuBar menuBar;//
	private JMenu menu_file;//
	private JMenu menu_tools;
	private JMenu menu_about;
	private JMenuItem menuItem_about;
	private JMenuItem menuItem_exit;
	//private JComboBox b1;//串口波特率选择组合框
	//private JComboBox b2;//CAN波特率选择组合框

	
	public home() {
		send= new JPanel();
		send.setPreferredSize(new Dimension(500,400));
		receive= new JPanel();
		receive.setPreferredSize(new Dimension(500,400));
//		Baud1 = new JLabel("串口波特率");
//		String[] r = new String[] {"300","600","1200","2400","4800","9600","19200","38400","57600","115200","128000","256000","961200"};
//		b1 = new JComboBox(r);
//		

		JTextArea area1 = new JTextArea();//文本区域
		JScrollPane sp1 = new JScrollPane(area1);//创建滚动面板，给文本域添加滚动条
		send.add(sp1);//发送框添加滚动面板
		setVisible(true);//设置窗口可见
		
		JTextArea area2 = new JTextArea();//文本区域
		JScrollPane sp2 = new JScrollPane(area2);//创建滚动面板，给文本域添加滚动条
		receive.add(sp2);//接收框添加滚动面板
		setVisible(true);//设置窗口可见
		
		
		id = new JLabel("序号");
		trans = new JLabel("传输方向");
		time = new JLabel("时间标识");
		fid = new JLabel("帧ID");
		fformat = new JLabel("帧格式");
		type = new JLabel("帧类型");
		length = new JLabel("数据长度");
		hex = new JLabel("数据（Hex）");
		
		send.add(id);
		send.add(trans);
		send.add(time);
		send.add(fid);
		send.add(fformat);
		send.add(type);
		send.add(length);
		send.add(hex);
		
		id1 = new JLabel("序号");
		trans1 = new JLabel("传输方向");
		time1 = new JLabel("时间标识");
		fid1 = new JLabel("帧ID");
		fformat1 = new JLabel("帧格式");
		type1 = new JLabel("帧类型");
		length1 = new JLabel("数据长度");
		hex1 = new JLabel("数据（Hex）");
		receive.add(id1);
		receive.add(trans1);
		receive.add(time1);
		receive.add(fid1);
		receive.add(fformat1);
		receive.add(type1);
		receive.add(length1);
		receive.add(hex1);
		
		tbPane = new JTabbedPane();
		String[] tabNames = {"发送框","接收框"};//tab面板添加发送框和接收框
		tbPane.addTab(tabNames[0],send);
		tbPane.addTab(tabNames[1],receive);
		
		//主面板
		home = new JPanel();
		home.add(tbPane);
		
		menuBar = new JMenuBar();//
		menu_file = new JMenu("文件");//
		menu_tools = new JMenu("工具");
		menu_about = new JMenu("帮助");
		menuItem_about = new JMenuItem("版本说明");
		menuItem_exit = new JMenuItem("退出");
		//将菜单项加入菜单
		menu_file.add(menuItem_exit);
		menu_about.add(menuItem_about);
		menuBar.add(menu_file);
		menuBar.add(menu_tools);
		menuBar.add(menu_about);
		
		this.add(home);
		this.setJMenuBar(menuBar);
		
		this.setVisible(true);
		this.setSize(1000,600);
		
	}
	public static void main(String[] args) {
		new home();
	}

}
